package cn.wolfcode.luowowo.acticle.domain;

import cn.wolfcode.luowowo.common.domain.BaseDomain;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
public class CityScenic extends BaseDomain {
    public static final int STATE_HOT = 1;//状态为热门
    public static final int STATE_NORMAL = 0;//状态为正常


    private Long dest_id;//目的地id

    private int refscenic;//关联景点的id

    //private Long[] refscenicIds;//关联景点的id

    private String scenicName;//景点名

    private String coverUrl;//景点图片

    private String[] coverUrls;//景点图片

    private Integer state = STATE_NORMAL;//状态

    private Integer sequence;//排序

    private String summary;//摘要

    private Integer replynum;//阅读数

    private List<CityScenic> children = new ArrayList<>();//关联的子景点

/*    //添加编辑时，前端传入是long数组， 数据库保存的是id拼接的字符串
    public String getRefscenic() {
        //id1,id2,id3
        return StringUtils.join(refscenicIds, ",");
    }

    //从数据库拿出的id拼接字符串转换成数组
    public Long[] getRefscenicIds() {
        Long[] ids = null;
        if (StringUtils.isNotBlank(refscenic)) {
            String[] strs = refscenic.split(",");
            ids = new Long[strs.length];
            for (int i = 0; i < strs.length; i++) {
                ids[i] = Long.parseLong(strs[i]);
            }
        }
        return ids;
    }*/


    //从数据库拿出的图片字符转分割成换成string数组,方便做页面图片回显;
    public String[] getCoverUrls() {
        String[] coverUrls = coverUrl.split(",");
        return  coverUrls;
    }


}